package com.pro.controller;

import com.pro.pojo.JsNumber;
import com.pro.pojo.JsonData;
import com.pro.service.commentStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName:commentStatisticsController
 * Package:com.pro.controller
 * Description:
 *
 * @Date:2022/2/2 17:51
 * @Author: XJR
 */
@RequestMapping("/commentStatistics")
@RestController
public class commentStatisticsController {

    @Autowired
    private commentStatisticsService service;

    //查看商品、视频、微圈评论总数
    @RequestMapping("/countBeforeAll")
    public JsonData countBeforeAll(Integer userType){
        JsNumber jsNumber = new JsNumber();
        Integer course = service.countBeforeAll(2,userType);
        Integer product = service.countBeforeAll(3,userType);
        Integer microcircle = service.countBeforeAll(4,userType);
        jsNumber.setCountJsCourse(course);
        jsNumber.setCountProduct(product);
        jsNumber.setCountJsMicrocircle(microcircle);
        return jsNumber!=null?JsonData.buildSuccess(jsNumber):JsonData.buildError("服务器发生错误");
    };
}
